﻿<div ng-controller="queryOrderController">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-inverse">
                <div class="panel-heading">
                    <div class="panel-heading-btn">
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default"
                           data-click="panel-expand"><i class="fa fa-expand"></i></a>
                    </div>
                    <h4 class="panel-title">订单管理</h4>
                </div>
                <div class="panel-body">
                    <div class="form-inline filter-option">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="pull-left">
                                    <button class="btn btn-info" ng-click="exportExcel()">信息导出（Excel）</button>
                                </div>
                                <div class="pull-right">
                                    <select class="form-control" ng-model="filter.status">
                                        <option value="">请选择订单状态</option>
                                        <option value="5">交易中</option>
                                        <option value="15">交易结束</option>
                                        <option value="25">所有状态</option>
                                        <option value="806">已付款确认</option>
                                        <option value="807">已背书</option>
                                        <option value="808">已签收</option>
                                        <option value="809">完成等待出票方确认票款</option>
                                        <option value="810">完成</option>
                                        <option value="811">出票方已评价</option>
                                        <option value="812">收票方已评价</option>
                                        <option value="813">双方均评价</option>
                                        <option value="814">申请用户介入</option>
                                        <option value="816">终止</option>
                                    </select>
                                    <!--<select class="form-control" ng-model="filter.tradeTypeCode">
                                        <option value="">请选择出票类型</option>
                                        <option value="701">现票卖断</option>
                                        <option value="702">预约出票</option>
                                    </select>-->
                                    <!--<input type="text" placeholder="请输入开始时间" id="start_time" name="start_time"
                                           class="form-control"/>
                                    <input type="text" placeholder="请输入结束时间" id="end_time" name="end_time"
                                           class="form-control"/>-->

                                    <!--<input class="form-control" type="text" ng-model="filter.enterpriseName"
                                           placeholder="请输入企业客户名称">
                                    <input class="form-control" type="text" ng-model="filter.customerName"
                                           placeholder="请输入客户名称">-->
                                    <input class="form-control" type="text" ng-model="filter.order_number"
                                           placeholder="请输入订单号">
                                    <button class="btn btn-sm btn-info" ng-click="reflash()"><i
                                            class="fa fa-search"></i> 筛选
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <table id="data-table" ng-table="tableParams" template-pagination="template/pagination.html"
                           class="table table-striped table-bordered table-hover table-condensed">
                        <tr ng-repeat="item in $data">
                            <td data-title="'序号'" width="10%" class="text-center">{{ first + $index }}</td>
                            <td data-title="'订单号'" sortable="'order_number'" class="text-center">{{ item.order_number
                                }}
                            </td>
                            <td data-title="'票据类型'" sortable="'bill_type_id'" class="text-center">{{ item.bill_type_name
                                }}
                            </td>
                            <td data-title="'票面金额'" sortable="'bill_sum_price'" class="text-right">{{
                                item.bill_sum_price | currency }}
                            </td>
                            <td data-title="'汇票到期日'" sortable="'bill_deadline_time'" class="text-center">{{
                                item.bill_deadline_time | date: 'yyyy-MM-dd' }}
                            </td>
                            <td data-title="'订单状态'" class="text-center">{{ item.order_status_description }}</td>
                            <td class="text-center width-100 text-nowrap">
                                <button class="btn btn-info btn-xs" 
                                        ng-if="item.order_status_id==805||item.order_status_id==808||item.order_status_id==809||item.order_status_id==814"
                                        ng-click="syncOrder(item.drawer_id,item.id)">
                                    <i class="fa fa-edit"></i> 同步
                                </button>
                                <button class="btn btn-info btn-xs" ng-click="check(item.id)">
                                    <i class="fa fa-edit"></i> 详细
                                </button>
                                <button class="btn btn-success btn-xs"
                                        ng-if="item.order_status_id>=810&&item.order_status_id<816"
                                        ng-click="showAppraisal(item)"><i class="fa fa-list"></i> 评价
                                </button>

                            </td>
                        </tr>
                    </table>
                </div>
                <div class="modal fade" id="modal-check">
                    <div class="modal-dialog" style="width:1100px">
                        <div class="modal-content">
                            <ng-form name="checkForm" novalidate>
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i>票据详情</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="form-horizontal">
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span> 票据类型：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.bill_type_name }}
                                            </div>
                                            <label class="control-label col-md-2"><span class="g-orange">*</span> 订单类型：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.order_type_name }}
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span> 票号：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.bill_number }}
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span> 订单号码：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.order_number }}
                                            </div>
                                            <label class="control-label col-md-2"><span class="g-orange">*</span> 订单状态：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.order_status_name }} ->{{ model.order_status_description }}
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span>
                                                票面金额[元]：</label>
                                            <div class="col-md-4 form-inline form-control-static">
                                                {{ model.bill_sum_price }} &nbsp; &nbsp;{{
                                                amountInWords(model.bill_sum_price) }}
                                            </div>
                                            <label class="control-label col-md-2">汇票到期日：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.bill_deadline_time | date: 'yyyy-MM-dd' }}
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2">汇票正面：</label>
                                            <div class="col-sm-4">
                                                <div class="tb-booth tb-pic tb-s250">
                                                    <a href="{{model.bill_front_photo_path}}" target="_blank">
                                                        <img class="jqzoom" src="{{model.bill_front_photo_path}}"
                                                             rel="{{model.bill_front_photo_path}}" alt="汇票正面未上传"/>
                                                    </a>
                                                </div>
                                            </div>
                                            <label class="control-label col-md-2">汇票背面：</label>
                                            <div class="col-sm-4">
                                                <div class="tb-booth tb-pic tb-s250">
                                                    <a href="{{model.bill_back_photo_path}}" target="_blank">
                                                        <img class="jqzoom" src="{{model.bill_back_photo_path}}"
                                                             rel="{{model.bill_back_photo_path}}" alt="汇票背面未上传"/>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2">承兑机构：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.acceptor_type_name }}
                                            </div>
                                            <label class="control-label col-md-2">承兑银行：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.acceptor_name }}
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2">订单生成时间：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{model.order_time | date: 'yyyy-MM-dd HH:mm:ss'}}
                                            </div>
                                            <label class="control-label col-md-2">成交金额：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.order_total_price }}元
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span>
                                                出票人：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.drawer_name }}
                                            </div>
                                            <label class="control-label col-md-2"><span class="g-orange">*</span> 出票人账户：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.drawer_account_number }}
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span>
                                                出票账户持卡人：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.drawer_account_person }}
                                            </div>
                                            <label class="control-label col-md-2"><span class="g-orange">*</span>
                                                出票账户银行：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.drawer_account_bank }}
                                            </div>
                                         <div class="form-group width-full">
                                                <label class="control-label col-md-2">
                                                    <span class="g-orange">*</span>
                                                    联系人：
                                                </label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.drawer_contract_name }}
                                                </div>
                                                <label class="control-label col-md-2">
                                                    <span class="g-orange">*</span>
                                                    联系人电话：
                                                </label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.drawer_contract_phone }}
                                                </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span>
                                                收票人：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.receiver_name }}
                                            </div>
                                            <label class="control-label col-md-2"><span class="g-orange">*</span> 收票人账户：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.receiver_account_number }}
                                            </div>
                                        </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"><span class="g-orange">*</span>
                                                收票账户持卡人：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.receiver_account_person }}
                                            </div>
                                            <label class="control-label col-md-2"><span class="g-orange">*</span>
                                                收票账户银行：</label>
                                            <div class="col-md-4 form-control-static">
                                                {{ model.receiver_account_bank }}
                                            </div>
                                        </div>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2">
                                                    <span class="g-orange">*</span>
                                                    联系人：
                                                </label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.receiver_contract_name }}
                                                </div>
                                                <label class="control-label col-md-2">
                                                    <span class="g-orange">*</span>
                                                    联系人电话：
                                                </label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.receiver_contract_phone }}
                                                </div>
                                            </div>
                                        <div class="form-group width-full">
                                            <label class="control-label col-md-2"> 备注信息：</label>
                                            <div class="col-md-10 form-control-static">
                                                {{ model.description }}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button class="btn btn-sm btn-white" data-dismiss="modal"><i
                                            class="fa fa-share-square-o"></i> 关闭
                                    </button>
                                </div>
                            </ng-form>
                        </div>
                    </div>
                </div>
                <div class="modal fade" id="modal-appraisal">
                    <div class="modal-dialog" style="width:1100px">
                        <div class="modal-content">
                            <ng-form name="checkForm" novalidate>
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i>评价详情</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <h4>出票方详情</h4>
                                            <hr/>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2">出票方名称：</label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.drawer_appraisal.enterprise_name }}
                                                </div>
                                            </div>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2">评分：</label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.drawer_appraisal.star }}星
                                                </div>
                                            </div>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2">评价时间：</label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.drawer_appraisal.appraisal_time | date : 'yyyy-MM-dd HH:mm:ss'}}
                                                </div>
                                            </div>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2"> 评价详细信息：</label>
                                                <div class="col-md-10 form-control-static">
                                                    {{ model.drawer_appraisal.description }}
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <h4>收票方评价</h4>
                                            <hr/>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2">收票方名称：</label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.receiver_appraisal.enterprise_name }}
                                                </div>
                                            </div>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2">评分：</label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.receiver_appraisal.star }}星
                                                </div>
                                            </div>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2">评价时间：</label>
                                                <div class="col-md-4 form-control-static">
                                                    {{ model.receiver_appraisal.appraisal_time | date : 'yyyy-MM-dd HH:mm:ss'}}
                                                </div>
                                            </div>
                                            <div class="form-group width-full">
                                                <label class="control-label col-md-2"> 评价详细信息：</label>
                                                <div class="col-md-10 form-control-static">
                                                    {{ model.receiver_appraisal.description }}
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                                <div class="modal-footer">
                                    <button class="btn btn-sm btn-white" data-dismiss="modal"><i
                                            class="fa fa-share-square-o"></i> 关闭
                                    </button>
                                </div>

                            </ng-form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

